package com.codedef.service;

import org.redisson.api.LocalCachedMapOptions;
import org.redisson.api.RLocalCachedMap;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class BloomCacheManager {

    @Autowired
    RedissonClient redissonClient;

    Map<String, RLocalCachedMap> managerMap = new HashMap<>();

    public RLocalCachedMap getCachedMap(String key) {
        if (managerMap.get(key) == null) {
            managerMap.put(key, redissonClient.getLocalCachedMap(key, LocalCachedMapOptions.defaults()));
        }
        return managerMap.get(key);
    }



}